#ifndef _LED_H_
#define	_LED_H_

#include "Custom_config.h"
#include "Audio_Spectrum_Flash.h"

#ifdef __C51__


#if(LED_TYPE==LED_DISPLAY_MODE )
#define LED_AUX	 	BIT(LED_A)
#define LED_FM		BIT(LED_B)
#define LED_USB		 BIT(LED_C)
#define LED_SD		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_E)
#define LED_MP3		 BIT(LED_G)

#define LED_STATUS   LED_BUFF[4]
#elif (LED_TYPE==LED_SW )
#define LED_AUX	 	BIT(LED_A)
#define LED_FM		BIT(LED_B)
#define LED_USB		 BIT(LED_C)
#define LED_SD		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_E)
#define LED_PLAY	0
#define LED_PAUSE	0
#define LED_MP3		 BIT(LED_G)
 #define LED_AM		0

#define LED_STATUS   LED_BUFF[4]
#elif (LED_TYPE==LED_NOR_AUX_PLAY)
#define LED_AUX	 	BIT(LED_G)
#define LED_FM		BIT(LED_E)
#define LED_USB		 BIT(LED_D)
#define LED_SD		 BIT(LED_F)
#define LED_2POINT	 BIT(LED_B)
#define LED_PLAY	BIT(LED_A)
#define LED_PAUSE	BIT(LED_C)
#define LED_MP3		0
 #define LED_AM		0

#define LED_STATUS   LED_BUFF[4]


#elif (LED_TYPE==LED_AJE_LED )

                 #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)

                 #define LED_MP3		 BIT(LED_G)
                 #define LED_FM		 BIT(LED_F)
                 #define LED_STATUS   LED_BUFF[4]
#elif (LED_TYPE==LED_SWD_LED)

#define LED_USB		 BIT(LED_D)
#define LED_AUX	 	BIT(LED_E)
#define LED_SD		 BIT(LED_F)
#define LED_FM		BIT(LED_A)
#define LED_2POINT	 BIT(LED_B)

#define LED_PAUSE	 BIT(LED_G)
#define LED_PLAY	0
#define LED_PLAY1	BIT(LED_G)
#define LED_STATUS6  LED_BUFF[6]

#define LED_NEXT	 BIT(LED_C)
#define LED_PREV    	 BIT(LED_G)
#define LED_STATUS5  LED_BUFF[5]


#define LED_MP3		 0
 #define LED_AM		0
#define LED_STATUS  LED_BUFF[4]

#elif (LED_TYPE==LED_HT)
 #define LED_AUX		BIT(LED_G)
	
#define LED_USB		 BIT(LED_C)
#define LED_SD		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_E)
   #define LED_TIME     BIT(LED_A)
#define LED_ALM          BIT(LED_B)               
#define LED_FM		 BIT(LED_F)//|BIT(LED_H)
#define LED_STATUS   LED_BUFF[4]
#elif (LED_TYPE==LED_ZK)
#define LED_PLAY	 BIT(LED_A)
#define LED_PAUSE	 BIT(LED_B)
#define LED_USB		 BIT(LED_C)
#define LED_SD		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_E)
#define LED_AUX	 	BIT(LED_F)
#define LED_FM		BIT(LED_G)
#define LED_MP3		 BIT(10)
#define LED_STATUS   LED_BUFF[4]
#elif (LED_TYPE==LED_BLT_LED)
#define LED_AUX	 	BIT(LED_A)
#define LED_FM		BIT(LED_C)
#define LED_USB		 BIT(LED_E)
#define LED_SD		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_G)
#define LED_BAT_L2		 BIT(LED_B)
#define LED_BAT_L1		 BIT(LED_F)

#define LED_STATUS   LED_BUFF[4]

#elif (LED_TYPE==LED_KPL_TUOYUAN)
#if  defined(K2041_SES)
#define LED_FM		BIT(LED_F)
#define LED_USB		 BIT(LED_C)
#define LED_2POINT	 BIT(LED_G)
#define LED_PLAY	 BIT(LED_A)
#define LED_PAUSE	 BIT(LED_B)
#define LED_SD		 BIT(LED_D)
#define LED_MP3		 BIT(LED_E)

#define LED_STATUS   LED_BUFF[4]

#else
#define LED_FM		BIT(LED_F)
#define LED_USB		 BIT(LED_C)
#define LED_2POINT	 BIT(LED_E)
#define LED_PLAY	 BIT(LED_A)
#define LED_PAUSE	 BIT(LED_B)
#define LED_SD		 BIT(LED_D)
#define LED_MP3		 BIT(LED_G)

#define LED_STATUS   LED_BUFF[4]
#endif
#elif (LED_TYPE==LED_MY_TUOYUAN)
#define LED_PLAY	 BIT(LED_A)
#define LED_PAUSE	 BIT(LED_B)
#define LED_USB		 BIT(LED_C)
#define LED_SD		 BIT(LED_D)
#define LED_MP3		 BIT(LED_E)
#define LED_FM		BIT(LED_F)
#define LED_2POINT	 BIT(LED_G)

#define LED_STATUS   LED_BUFF[4]

#elif (LED_TYPE==LED_DCX_PINPU)
#define LED_SD		 BIT(LED_A)
#define LED_2POINT	 BIT(LED_B)
#define LED_PAUSE	 BIT(LED_C)
#define LED_USB		 BIT(LED_D)
#define LED_AUX	 	BIT(LED_E)
#define LED_FM		BIT(LED_F)
#define LED_PLAY	 BIT(LED_G)
#define LED_STATUS   LED_BUFF[4]

#elif (LED_TYPE==LED_OK_LED)
                 #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)
                 #define LED_AUX	 	BIT(LED_F)
                 #define LED_FM		 BIT(LED_G)
                 #define LED_STATUS   LED_BUFF[4]

#elif (LED_TYPE==LED_DCX_TUOYUAN)
#define LED_FM		BIT(LED_F)
#define LED_AUX           BIT(LED_C)
#define LED_2POINT	 BIT(LED_E)
#define LED_PLAY	 BIT(LED_A)
#define LED_PAUSE	 BIT(LED_B)
#define LED_SD		 BIT(LED_D)
#define LED_MP3		 BIT(LED_G)
#define LED_STATUS   LED_BUFF[4]

#elif (LED_TYPE==LED_DL_LED)
#define LED_FM		BIT(LED_F)
#define LED_USB		 BIT(LED_G)
#define LED_2POINT	 0
#define LED_PLAY	 0
#define LED_PAUSE	0
#define LED_SD		 BIT(LED_C)
#define LED_MP3		 0
#define LED_AUX	 	BIT(LED_D)

#define LED_STATUS   LED_BUFF[4]

#elif (LED_TYPE==LED_TUOYUAN_LED)
#define LED_AUX	 	BIT(LED_A)
#define LED_FM		BIT(LED_B)
#define LED_USB		 BIT(LED_F)
#define LED_2POINT	 BIT(LED_G)
#define LED_PLAY	 BIT(LED_D)
#define LED_PAUSE	 BIT(LED_E)
#define LED_SD		 BIT(LED_C)
#define LED_STATUS   LED_BUFF[4]
#elif (LED_TYPE==LED_DCX_LED)
                 #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)

                 #define LED_FM		 BIT(LED_F)


                 #define LED_MP3		 BIT(LED_G)
                 #define LED_STATUS   LED_BUFF[4]
			 
#elif (LED_TYPE==LED_LSF_LED)

#define LED_AUX	 	BIT(LED_A)
#define LED_2POINT	 BIT(LED_G)
#define LED_PAUSE	 BIT(LED_F)
#define LED_PLAY	 BIT(LED_B)
#define LED_FM		BIT(LED_C)



#define LED_SD		 BIT(LED_D)	
#define LED_USB		 BIT(LED_E)


#define LED_STATUS   LED_BUFF[4]
/*#elif (LED_TYPE==LED_USE_1X888 )

#define LED_PLAY	 BIT(LED_A)
#define LED_PAUSE	 BIT(LED_B)
#define LED_USB		 BIT(LED_C)
#define LED_SD		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_E)

#define LED_MP3		 BIT(LED_F)
#define LED_FM		 BIT(LED_H)
#define LED_STATUS   LED_BUFF[2]*/
#elif (LED_TYPE==LED_MY_RTC_MODE)

#define LED_TIME        BIT(LED_A)
#define LED_ALM	        BIT(LED_B)
#define LED_USB		 BIT(LED_C)
#define LED_SD		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_E)
#define LED_AUX		 BIT(LED_G)
#define LED_FM		 BIT(LED_F)
#define LED_STATUS   LED_BUFF[4]


#elif (LED_TYPE==LED_FXK_RTC_MODE )
#if  defined(WK_JLYTR8_V001)
#define LED_SD     	BIT(LED_A)
#define LED_FM	      BIT(LED_B)
#define LED_USB		 BIT(LED_C)
#define LED_AUX		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_E)
#define LED_BAT_L2		 BIT(LED_F)
#define LED_BAT_L1		 BIT(LED_G)

#define LED_STATUS   LED_BUFF[4]
#elif  defined(K3030_1185_WXD)
#define LED_FM     	BIT(LED_A)
#define LED_SD	      BIT(LED_B)
#define LED_USB		 BIT(LED_C)
#define LED_AUX		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_E)
#define LED_BAT_L2		 BIT(LED_F)
#define LED_BAT_L1		 BIT(LED_G)

#define LED_STATUS   LED_BUFF[4]
#else
#define LED_USB		 BIT(LED_C)
#define LED_SD		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_E)
#define LED_TIME	BIT(LED_A)
#define LED_ALM	      BIT(LED_B)
#define LED_BAT_L2		 BIT(LED_F)
#define LED_BAT_L1		 BIT(LED_G)

#define LED_STATUS   LED_BUFF[4]
#endif


#elif (LED_TYPE==LED_RTC_MODE )
#define LED_AUX		BIT(LED_A)

#define LED_USB		 BIT(LED_C)
#define LED_SD		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_E)
#define LED_FM		BIT(LED_F)
#define LED_TIME	BIT(LED_B)
#define LED_ALM	      BIT(LED_G)
#define LED_STATUS   LED_BUFF[4]

#elif (LED_TYPE==LED_FUWEI_LED)

#define LED_FM		BIT(LED_A)
#define LED_AUX		BIT(LED_B)
#define LED_USB		 BIT(LED_C)
#define LED_2POINT	 BIT(LED_E)
#define LED_ALM	      BIT(8)
#define LED_BAT_L1		 BIT(LED_F)
#define LED_BAT_L2		 BIT(LED_G)
#define LED_BAT_L3		 BIT(LED_H)

 #define LED_STATUS  led_staus// LED_BUFF[4]
#elif (LED_TYPE==LED_CHARGE_LED)

#if  defined( K1066_CX_209A)
  #define LED_AUX		0
 #define LED_PLAY	 BIT(LED_B)
#define LED_USB		 BIT(LED_C)

#define LED_SD		 BIT(LED_D)

 #define LED_2POINT	 BIT(LED_E)
                 
#define LED_FM		 BIT(LED_A)

#define LED_BAT_L2		 BIT(LED_F)
#define LED_BAT_L1		 BIT(LED_G)
 #define LED_STATUS   LED_BUFF[4]

#elif  defined(K2092_DNK_APPLE_XL)
#define LED_AUX		0
#define LED_PLAY 	 BIT(LED_A)
#define LED_USB		 BIT(LED_C)

#define LED_SD		 BIT(LED_D)

 #define LED_2POINT	 BIT(LED_E)
                 
#define LED_FM		 BIT(LED_B)

#define LED_BAT_L2		 BIT(LED_F)
#define LED_BAT_L1		 BIT(LED_G)
 #define LED_STATUS   LED_BUFF[4]
#else
 #define LED_AUX		BIT(LED_D)

#define LED_USB		 BIT(LED_C)
#define LED_SD		 BIT(LED_A)
 #define LED_2POINT	 BIT(LED_E)
                 
#define LED_FM		 BIT(LED_B)


#define LED_BAT_L2		 BIT(LED_F)
#define LED_BAT_L1		 BIT(LED_G)
 #define LED_STATUS   LED_BUFF[4]
 #endif
#elif (LED_TYPE==LED_ZH_CHARGE_LED)
#define LED_FM		BIT(LED_A)
#define LED_AUX		BIT(LED_B)
#define LED_USB		 BIT(LED_C)
#define LED_2POINT	 BIT(LED_E)
#define LED_ALM	      BIT(8)
#define LED_BAT_L1		 BIT(LED_F)
#define LED_BAT_L2		 BIT(LED_G)
#define LED_BAT_L3		 BIT(LED_H)
#define LED_SD		 BIT(9)

 #define LED_STATUS  led_staus// LED_BUFF[4]

  
#elif (LED_TYPE==LED_TUOYUAN_CHARGE_LED)
#if defined(K3100_WK_H5)||defined(K1184_835_YHD)||defined(K2071_ZK_V001_071)||defined(K1070)||defined(K2071_HF_LBJN_821_YHDd)||defined(K1185_YHD)||defined(K1200_YHD)||defined(K1184_ZK_989_V001)||defined(K1208_957_ZK)||defined(K1212_991_ZK)||defined(K1213_859_YHD)||defined(K2115_937_ZK)||defined(K1185_868_YHD)||defined(K2115_X6_WXD) \
	||defined(WK_JLR8_V001)||defined(ALK_997_ZK)||defined(K3025_ZK)||defined(K1212_ALK_998_ZK)||defined(K1142_1361_WXD)||defined(K1228_ALK_502_ZK) \
	||defined(K1177_886_YHD)||defined(K1212_YHD_896)||defined(K1110_899_YHD)||defined(K1185_898_YHD)||defined(ALK_997_MINI_ZK)||defined(K1231_ZK_V001) \
	||defined(UN_USE_CART_BIT)
#define LED_AUX	 	BIT(LED_A)
#define LED_FM		BIT(LED_C)
#define LED_USB		 BIT(LED_D)
#define LED_SD		 BIT(LED_E)
#define LED_2POINT	 BIT(LED_G)
#define LED_BAT_L2		 BIT(LED_B)
#define LED_BAT_L1		 BIT(LED_F)
  #define LED_STATUS   LED_BUFF[4]
  #elif  defined(K2064_Y952_YHD)||defined(K1185_868_AP)||defined(K1185_SW_V001)
  #define LED_AUX	 	0
  #define LED_ALM      BIT(LED_A)
#define LED_FM		BIT(LED_C)
#define LED_USB		 BIT(LED_E)
#define LED_SD		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_G)
#define LED_BAT_L2		 BIT(LED_B)
#define LED_BAT_L1		 BIT(LED_F)
  #define LED_STATUS   LED_BUFF[4]
  #elif  defined(K1127_MY)
#define LED_PLAY	 BIT(LED_A)
#define LED_PAUSE	 BIT(LED_B)
#define LED_AUX	 	0
#define LED_FM		BIT(LED_C)
#define LED_USB		 BIT(LED_D)
#define LED_SD		 BIT(LED_E)
#define LED_2POINT	 BIT(LED_G)
#define LED_BAT_L2		 BIT(LED_F)
#define LED_BAT_L1		 0

  #define LED_STATUS   LED_BUFF[4]
#else
#define LED_AUX	 	BIT(LED_A)
#define LED_FM		BIT(LED_C)
#define LED_USB		 BIT(LED_E)
#define LED_SD		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_G)
#define LED_BAT_L2		 BIT(LED_B)
#define LED_BAT_L1		 BIT(LED_F)

  #define LED_STATUS   LED_BUFF[4]
#endif
#elif ( LED_TYPE==LED_JR)
                 #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)
                 #define LED_MP3		 BIT(LED_G)
                 #define LED_FM		 BIT(LED_F)
                 #define LED_STATUS   LED_BUFF[4]
#elif ( LED_TYPE==LED_JR_C)

                 #define LED_PLAY	 0
                 #define LED_PAUSE	 0
                 
                 #define LED_AUX        BIT(LED_A)
		  #define  LED_DVD        BIT(LED_D)	 
                 #define LED_USB		 BIT(LED_G)
                 #define LED_SD		 BIT(LED_C)
                 #define LED_2POINT	 BIT(LED_F)
                 #define LED_MP3		 BIT(LED_B)
                 #define LED_FM		 BIT(LED_E)
                 #define LED_STATUS   LED_BUFF[4]				 
			 
#elif ( LED_TYPE==LED_JR_AUX)
                 #define LED_AUX			 BIT(LED_F)
                 #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)
                 
                 #define LED_FM		 BIT(LED_G)
                 #define LED_STATUS   LED_BUFF[4]
                 #define LED_ALM	      BIT(10)
#elif ( LED_TYPE==LED_JYHL_LED)
                 #define LED_AUX			 BIT(LED_F)
                 #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)
                 
                 #define LED_FM		 BIT(LED_G)
                 #define LED_STATUS   LED_BUFF[4]
#elif ( LED_TYPE==LED_USE_1X888)
#ifdef K1178_829_YHD
#define LED_2POINT	 BIT(LED_E)
#endif

#define LED_FM		 BIT(LED_A)
#define LED_STATUS   LED_BUFF[4]
#define LED_SEG_DP  P17		

#elif  defined(K768_FUWEI_02_703)	
#define LED_2POINT	 BIT(LED_E)

#define LED_FM		 BIT(LED_G)
#define LED_STATUS   LED_BUFF[4]
#define LED_SEG_DP  P15

#elif(LED_TYPE==LED_888_11)
#define LED_PLAY	 0
#define LED_PAUSE	 0
#define LED_USB		 0
#define LED_SD		 0
#define LED_2POINT	 0
#define LED_MP3		 0
#define LED_FM		 0

#define LED_STATUS   LED_BUFF[4]
#elif ( LED_TYPE==LED_4X8888||LED_TYPE==LED_RT_4X8888)
#define LED_2POINT	 BIT(LED_E)
#define LED_FM		 BIT(LED_G)
#define LED_STATUS   LED_BUFF[4]
#define LED_SEG_DP  P17
#elif (LED_TYPE==GPIO_LCD_SM538)
#define LED_USB		 BIT(LED_A)
#define LED_SD		 BIT(LED_B)
#define LED_2POINT	 BIT(LED_C)
#define LED_FM		 BIT(LED_D)
#define LED_TIME	BIT(LED_E)
#define LED_AUX		 BIT(LED_F)
#define LED_ALM	        BIT(LED_G)

#define LED_STATUS   LED_BUFF[4]

#define   com_init()    P3PD |= (0x0F); P3PU |= (0x0F);
#define   close_com(n)    com_init();P3DIR |= (0x0F);P3DIR &= ~(0x08>>(n)) ;
#define	set_com(n)      P3 |= (0x08>>(n)) ;// P3 |= (1<<(n)) ;
#define   clr_com(n)      P3 &= ~(0x08>>(n));//  P3 &= ~(1<<(n));
#define   seg07_port(n)   	P1 = n
#define   seg_init()           P1DIR = 0;P3DIR &= ~(1<<4)
#define   seg8_port(n)	P34 = n
#elif ( LED_TYPE==GPIO_LCD_SRX0353)
#define LED_USB		 BIT(LED_A)
#define LED_SD		 BIT(LED_B)
#define LED_2POINT	 BIT(LED_C)
#define LED_FM		 BIT(LED_D)
#define LED_TIME	BIT(LED_E)
#define LED_MUTE	 BIT(LED_F)
#define LED_ALM	        BIT(LED_G)
#define LED_AUX		 BIT(LED_H)


#define LED_AUX1		 BIT(LED_A)
#define LED_AUX2		 BIT(LED_B)
#define LED_DIGITAL		 BIT(LED_C)


#define   com_init()    P3PD |= (0x1F); P3PU |= (0x1F);
#define   close_com(n)    com_init();P3DIR |= (0x1F);P3DIR &= ~(0x10>>(n)) ;
#define	set_com(n)      P3 |= (0x10>>(n)) ;// P3 |= (1<<(n)) ;
#define   clr_com(n)      P3 &= ~(0x10>>(n));//  P3 &= ~(1<<(n));
#define   seg_init()           P1DIR = 0;
#define   seg07_port(n)   	P1 = n


#define LED_STATUS   LED_BUFF[4]
#define LED_STATUS1   LED_BUFF[5]

#elif  (LED_TYPE==GPIO_LCD_13PIN_ZX)
#define LED_PLAY	 BIT(LED_A)
#define LED_PAUSE     BIT(LED_B)
#define LED_USB		 BIT(LED_C)
#define LED_SD		 BIT(LED_D)
#define LED_2POINT	 BIT(LED_E)
#define LED_FM		 BIT(LED_F)

#define LED_STATUS   LED_BUFF[4]

#define   com_init()        P1DIR &=~(0x0F);
#define   close_com(n)    com_init();P1DIR |= (0x0F);P1DIR &= ~(0x01<<(n)) ;
#define	set_com(n)      P1 |= (0x01<<(n)) ;
#define   clr_com(n)      P1 &= ~(0x01<<(n));
#define   seg_init()         P1DIR &=~(0xF0);P3DIR&=~(0x1F);P0DIR&=~(BIT(4));
#define   seg_0(n)        P04 = n
#define   seg_1(n)        P34 = n
#define   seg_2(n)        P33 = n
#define   seg_3(n)        P32 = n
#define   seg_4(n)        P31 = n
#define   seg_5(n)        P30 = n
#define   seg_6(n)        P16 = n
#define   seg_7(n)        P15 = n
#define   seg_8(n)        P14 = n

#elif (LED_TYPE==GPIO_LCD_11PIN_SM5296)
#define  LED_FM            BIT(LED_A)
#define  LED_AM            BIT(LED_B)
#define  LED_2POINT     BIT(LED_C)
#define  LED_DOT           BIT(LED_D)

#define  LED_STATUS   LED_BUFF[4]

#define   com_init()         P3HD|= (0x0F); P3PU|= (0x0F);
#define   close_com(n)    com_init();P3DIR |= (0x0F);P3DIR &= ~(0x08>>(n)) ;
#define	set_com(n)      P3 |= (0x08>>(n)) ;// P3 |= (1<<(n)) ;
#define   clr_com(n)      P3 &= ~(0x08>>(n));//  P3 &= ~(1<<(n));
#define   seg_init()           P1DIR = 0;
#define   seg07_port(n)   	P1 = n

#elif ( LED_TYPE==GPIO_LCD_13PIN||LED_TYPE==GPIO_LCD_SM538)
#define LED_USB		 BIT(LED_A)
#define LED_SD		 BIT(LED_B)
#define LED_2POINT	 BIT(LED_C)
#define LED_FM		 BIT(LED_D)
#define LED_TIME	BIT(LED_E)

#define LED_MUTE	 BIT(LED_F)
#define LED_ALM	        BIT(LED_G)

#define LED_STATUS   LED_BUFF[4]
 #if defined(K538_JIAMEI_dd)
#define   com_init()    P3PD |= (0x0F); P3PU |= (0x0F);
#define   close_com(n)    com_init();P3DIR |= (0x0F);P3DIR &= ~(1<<(n))  
#define	set_com(n)       P3 |= (1<<(n))
#define   clr_com(n)       P3 &= ~(1<<(n)) 	
#define   seg_init()           P1DIR = 0;
#define   seg07_port(n)   	P1 = n
#else
#define   com_init()    P3PD |= (0x1F); P3PU |= (0x1F);
#define   close_com(n)    com_init();P3DIR |= (0x1F);P3DIR &= ~(0x10>>(n)) ;
#define	set_com(n)      P3 |= (0x10>>(n)) ;// P3 |= (1<<(n)) ;
#define   clr_com(n)      P3 &= ~(0x10>>(n));//  P3 &= ~(1<<(n));
#define   seg_init()           P1DIR = 0;
#define   seg07_port(n)   	P1 = n
#endif

#elif ( LED_TYPE==GPIO_LCD)

#define LED_USB		 BIT(LED_A)
#define LED_SD		 BIT(LED_B)
#define LED_2POINT	 BIT(LED_C)
#define LED_FM		 BIT(LED_D)
#define LED_AUX		 BIT(LED_E)
#define LED_MUTE	 BIT(LED_F)
#define LED_ALM	        BIT(LED_G)
#define LED_LDO1	 BIT(LED_H)
#define LED_LDO2        BIT(8)

#define LED_STATUS   LED_BUFF[4]

#define   com_init()    P3PD |= (0x0F); P3PU |= (0x0F);
#define   close_com(n)    com_init();P3DIR |= (0x0F);P3DIR &= ~(1<<(n))  
#define	set_com(n)       P3 |= (1<<(n))
#define   clr_com(n)       P3 &= ~(1<<(n)) 	
#define   seg_init()           P1DIR = 0;P3DIR &= ~(1<<4);P0DIR &= ~(1<<(2));
#define   seg07_port(n)   	P1 = n
#define   seg8_port(n)	P34 = n
#define   seg9_port(n) 	P02 = n;
#elif ( LED_TYPE==GPIO_LCD_14PIN)
#define LED_USB		 BIT(LED_A)
#define LED_SD		 BIT(LED_B)
#define LED_2POINT	 BIT(LED_C)
#define LED_FM		 BIT(LED_D)
#define LED_AUX		 BIT(LED_E)
#define LED_MUTE	 BIT(LED_F)
#define LED_ALM	        BIT(LED_G)

#define  LED_BAT_L1   BIT(LED_A)
#define  LED_BAT_L2   BIT(LED_B)
#define  LED_BAT_L3   BIT(LED_C)

//#define LED_LDO1	 BIT(LED_H)
//#define LED_LDO2        BIT(8)
#define LED_STATUS   LED_BUFF[4]
#define LED_STATUS3   LED_BUFF[5]

#define   com_init()    P3HD|= (0x0F); P3PU |= (0x0F);
#define   close_com(n)    com_init();P3DIR |= (0x0F);P3DIR &= ~(1<<(n))  
#define	set_com(n)       P3 |= (1<<(n))
#define   clr_com(n)       P3 &= ~(1<<(n)) 	
#define   seg_init()           P1DIR = 0;P3DIR &= ~(1<<4);P0DIR &= ~(1<<(2));
#define   seg07_port(n)   	P1 = n
#define   seg8_port(n)	  P3DIR &= ~(1<<4);P34 = n;
#define   seg9_port(n) 	P0DIR &= ~(1<<(2)); P02 = n;

#elif ( LED_TYPE==GPIO_LCD_16PIN)

#define LED_PLAY	 BIT(LED_A)
#define LED_PAUSE     BIT(LED_B)
#define LED_2POINT	 BIT(LED_C)
#define LED_FM		 BIT(LED_D)
#define LED_AUX		 BIT(LED_E)
#define LED_MUTE	 BIT(LED_F)
#define LED_ALM	        BIT(LED_G)

#define  LED_IPOD                  BIT(LED_A)
#define  LED_BLUE                  BIT(LED_B)
#define  LED_AM                     BIT(LED_C)
#define  LED_PM                     BIT(LED_D)
#define  LED_NEXT        BIT(LED_E)
#define  LED_PREV         BIT(LED_F)

#define LED_STATUS    LED_BUFF[4]
#define LED_STATUS1   LED_BUFF[5]

#define   com_init()    P3PD |= (0x0F); P3PU |= (0x0F);
#define   close_com(n)    com_init();P3DIR |= (0x0F);P3DIR &= ~(1<<(n))  
#define	set_com(n)       P3 |= (1<<(n))
#define   clr_com(n)       P3 &= ~(1<<(n)) 	
#define   seg_init()           P1DIR = 0;P3DIR &= ~(1<<4);P0DIR &= ~(1<<(2));P2DIR &= ~(1<<7);P2DIR &= ~(1<<6);
#define   seg07_port(n)   	P1 = n
#define   seg8_port(n)	P2DIR &= ~(1<<7);P27 = n;
#define   seg9_port(n) 	P2DIR &= ~(1<<6);P26 = n;
#define   seg10_port(n)	P0DIR &= ~(1<<(2));P02 = n;
#define   seg11_port(n)	P3DIR &= ~(1<<4);P34 = n;

#elif defined(USE_LCD_DRV_HT1621)

                 #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)
                 #define LED_MP3		 BIT(LED_F)
                 #define LED_AUX	BIT(LED_H)	
		 #define LED_FM		 BIT(LED_G)
				 
                 #define LED_STATUS   LED_BUFF[4]
				 
	          #define LED_MUTE	BIT(LED_A)			 
                 #define LED_SUB	       BIT(LED_B)
	         #define LED_ALM	        BIT(LED_C)
		 #define LED_SUR       BIT(LED_D)
		 #define LED_CEN		 BIT(LED_E)
              #define LED_FRON	BIT(LED_F)
		 #define LED_DB	BIT(LED_G)
		 #define LED_STBY	BIT(LED_H)
		#define LED_LOGO	BIT(8)
		#define LED_SCAN	BIT(9)
		#define LED_CH_DN	   BIT(10)
		#define LED_CH_UP	   BIT(11)
		#define LED_PLAY_PAUSE	   BIT(12)
				#define LED_SAVE	   BIT(13)


	         #define LED_TIME	0

	         #define LED_STATUS1   lcd_STATUS
#elif ( LED_TYPE==LED_SWD_LED2)
#define LED_SD		 BIT(LED_A)
#define LED_USB		 BIT(LED_B)
#define LED_FM		 BIT(LED_C)
#define LED_2POINT	 BIT(LED_D)
#define LED_MP3          BIT(LED_E)
#define LED_PLAY        BIT(LED_F)
#define LED_PAUSE     BIT(LED_G)
#define LED_WMA       BIT(LED_H)


#define LED_PLAY_MODE	 BIT(LED_A)
#define LED_STOP        BIT(LED_B)
#define LED_NEXT      BIT(LED_C)
#define LED_PREV     BIT(LED_D)

	         #define LED_STATUS1   LED_BUFF[6]
                 #define LED_STATUS   LED_BUFF[4]

#elif ( LED_TYPE==LED_AM_LED)

                 #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)

                 #define LED_AM		 BIT(LED_F)
                 #define LED_FM		 BIT(LED_G)
                 #define LED_STATUS   LED_BUFF[4]
#elif (LED_TYPE==LED_HONGSHENG_12)
	#if  defined(HT148_V001)
                 #define LED_USB		  BIT(LED_D)
                 #define LED_SD		        BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_G)
                 #define LED_FM		        BIT(LED_C)
                 #define LED_AUX		 BIT(LED_A)
                 #define LED_AM		        BIT(LED_E)

                 #define  LED_BAT_L1   BIT(LED_F)
                 #define  LED_BAT_L2   BIT(LED_B)

                 #define LED_STATUS   LED_BUFF[4]
	#elif  defined(K1208_998_ZK)||defined(K1246_YJH)
		   #define LED_USB		  BIT(LED_E)
                 #define LED_SD		        BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_G)
                 #define LED_FM		        BIT(LED_C)
                 #define LED_AUX		 BIT(LED_A)
                 #define LED_AM		        0

                 #define  LED_BAT_L1       BIT(LED_F)
                 #define  LED_BAT_L2       BIT(LED_B)

                 #define LED_STATUS   LED_BUFF[4]
	#else
                 #define LED_USB		 0
                 #define LED_SD		        BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_G)
                 #define LED_FM		        BIT(LED_C)
                 #define LED_AUX		 BIT(LED_A)
                 #define LED_AM		        BIT(LED_E)

                 #define  LED_BAT_L1   BIT(LED_F)
                 #define  LED_BAT_L2   BIT(LED_B)

                 #define LED_STATUS   LED_BUFF[4]
	#endif
#elif ( LED_TYPE==LED_PLAY_AUX)

                 #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)

                 #define LED_AUX        BIT(LED_F)
                 #define LED_FM		 BIT(LED_G)
                 #define LED_STATUS   LED_BUFF[4]		
#elif ( LED_TYPE==LED_RTC_ALM_LED)
                 #define LED_PLAY	 0
                 #define LED_PAUSE	 0
                 #define LED_TIME	 BIT(LED_A)
                 #define LED_ALM      BIT(LED_B)				 
                 #define LED_USB	 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT BIT(LED_E)

                 #define LED_MP3	 0
		   #define LED_AUX      BIT(LED_G)
                 #define LED_FM		 BIT(LED_F)
                 #define LED_STATUS   LED_BUFF[4]				 

#elif ( LED_TYPE==LED_HSL_LED)
                 #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)

                 #define LED_MP3		 BIT(LED_G)
                 #define LED_FM		 BIT(LED_F)
                 #define LED_STATUS   LED_BUFF[4]
#elif (LED_TYPE==LED_8888_SWD)
			#define LED_2POINT	 BIT(LED_E)

			#define LED_FM		 BIT(LED_G)
			#define LED_STATUS   LED_BUFF[4]
#elif (LED_TYPE==LED_KPL_1651_LED)
                 #define LED_PLAY	 0
                 #define LED_PAUSE	 0
		 //  #define LED_AM		 0
		   #define LED_FM         BIT(LED_B)
                 #define LED_USB	 BIT(LED_E)
                 #define LED_MP3	 0
                 #define LED_AM  	 BIT(LED_A)
		   #define LED_AUX      0
		   #define LED_ALM      BIT(LED_C)
		   #define LED_DOT       BIT(LED_G)
		   #define LED_2POINT   BIT(LED_D)
		   #define LED_SD          BIT(LED_F)
		//   #define LED_BAT_L3  BIT(LED_H)            //buf[4]
		//   #define LED_BAT_L2  BIT(LED_H)            //buf[3]
		//   #define LED_BAT_L1  BIT(LED_H)            //buf[2]

		    #define LED_BAT_L3  BIT(LED_C)            //buf[4]
		   #define LED_BAT_L2  BIT(LED_B)            //buf[3]
		   #define LED_BAT_L1  BIT(LED_A)            //buf[2]   
		   
                 #define LED_STATUS     LED_BUFF[4]
		   #define LED_STATUS1   LED_BUFF[6]	  // #define LED_IPOD       BIT(LED_B)
#elif (LED_TYPE==LED_KPL_SMALL_1651_LED)
#if defined(K2130B_MY)||defined(K2130A_MY)||defined(K2090_JGY)
#define LED_USB		 BIT(LED_A)
#define LED_FM		 BIT(LED_B)
#define LED_AUX		 BIT(LED_C)
#define LED_SD		 BIT(LED_D)
#define LED_PLAY	 BIT(LED_F)
#define LED_2POINT	 BIT(LED_G)
#define LED_PAUSE	 BIT(LED_H)
#define LED_DOT       BIT(LED_E)

#define LED_STATUS     LED_BUFF[4]
#else
#define LED_USB		 BIT(LED_A)
#define LED_FM		 BIT(LED_B)
#define LED_MP3		 BIT(LED_C)
#define LED_SD		 BIT(LED_D)
#define LED_PLAY	 BIT(LED_F)
#define LED_2POINT	 BIT(LED_G)
#define LED_PAUSE	 BIT(LED_H)
#define LED_DOT       BIT(LED_E)

#define LED_STATUS     LED_BUFF[4]
#endif
#elif (LED_TYPE==LED_BAILITONG_13PIN)
                 #define LED_PLAY	 0
                 #define LED_PAUSE	 0
		   #define LED_AM		 0
                 #define LED_USB	 BIT(LED_C)
                 #define LED_MP3	 0
                 #define LED_FM		 BIT(LED_A)
		   #define LED_AUX       BIT(LED_B)
		   #define LED_DOT       BIT(LED_D)
	    //--------STATU1------			 
		   #define LED_IPOD       BIT(LED_H)
		   #define LED_2POINT   BIT(LED_H)
		   #define LED_SD          BIT(LED_H)
				 
                 #define LED_STATUS     LED_BUFF[4]
		   #define LED_STATUS1   LED_BUFF[0]	  // #define LED_IPOD       BIT(LED_B)
		    #define LED_STATUS2   LED_BUFF[1]	 //#define LED_2POINT   BIT(LED_B)
		     #define LED_STATUS3   LED_BUFF[3]	 // LED_SD          BIT(LED_B)
#else
                   #ifdef K138_QINDEXIN
                 #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)
                 
                 #define LED_MP3		 BIT(LED_G)
                 #define LED_FM		 BIT(LED_F)
                 #define LED_STATUS   LED_BUFF[4]
                 #define LED_ALM	      BIT(10)

		   #elif	defined(K1079_BAILITONG)
		    #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)
                 
                 #define LED_MP3		 BIT(LED_G)
                 #define LED_FM		 BIT(LED_F)
                 #define LED_STATUS   LED_BUFF[4]
                 #define LED_ALM	      BIT(10)
		#elif  defined(LS_292_005)
		   #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)

                 #define LED_AUX		 BIT(LED_F)
                 #define LED_FM		 BIT(LED_G)
                 #define LED_STATUS   LED_BUFF[4]
		
                   #else
				   
                 #define LED_PLAY	 BIT(LED_A)
                 #define LED_PAUSE	 BIT(LED_B)
                 #define LED_USB		 BIT(LED_C)
                 #define LED_SD		 BIT(LED_D)
                 #define LED_2POINT	 BIT(LED_E)

                 #define LED_MP3		 BIT(LED_F)
                 #define LED_FM		 BIT(LED_G)
                 #define LED_STATUS   LED_BUFF[4]
			 
                #endif
#endif
#endif
#define LED_A   0
#define LED_B	1
#define LED_C	2
#define LED_D	3
#define LED_E	4
#define LED_F	5
#define LED_G	6
#define LED_H	7



#ifndef  LED_MP3
#define  LED_MP3 0
#endif

#ifndef  LED_PLAY
#define  LED_PLAY 0
#endif


#ifndef  LED_FM
#define  LED_FM 0
#endif

#ifndef  LED_PAUSE
#define  LED_PAUSE 0
#endif


#ifndef  LED_AUX
#define  LED_AUX 0
#endif

#ifndef  LED_USB
#define  LED_USB 0
#endif


#ifndef  LED_SD
#define  LED_SD 0
#endif

#ifndef  LED_2POINT
#define  LED_2POINT 0
#endif

#ifndef  LED_TIME
#define  LED_TIME 0
#endif

#ifndef  LED_ALM
#define  LED_ALM 0
#endif


#ifndef  LED_MUTE
#define  LED_MUTE 0
#endif

#ifndef  LED_LDO1
#define  LED_LDO1 0
#endif


#ifndef  LED_LDO2
#define  LED_LDO2 0
#endif

#ifndef  LED_LDO3
#define  LED_LDO3 0
#endif

#ifndef  LED_AM
#define  LED_AM 0
#endif

typedef enum {

	LED_FLASH_ON,
	LED_FLASH_FAST,
	LED_FLASH_NOR,
	LED_FLASH_STOP,
 
	
}LED_FLASH_TYPE;
void disp_scan(void);
void set_play_flash(LED_FLASH_TYPE led_status);
void Disp_ldoin_voltage();
void updateLED(void);


 #ifdef EN_ELECTRIC_TORCH
  void electrc_torch_led_flash();
 #endif

#define set_led_off()  P1DIR = 0;P3DIR &= ~0x1f;P3&=~0x1f;P1&=~0x7f;
#if defined( K598_YJH)
void K598_play_led_flash();
#endif
void get_curr_setting_data(u8 setting);


#endif
